# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Marco Schröder <marco.schroeder96@gmail.com>
pkgname=amazfish
pkgver=2.0.8
pkgrel=0
_commit_qble="3631992ff3bf71a4680f18487e05486c134a1805"
_commit_libwatchfish="4ff850cad55866a9e43e2f6ec3488ce792db1196"
pkgdesc="Companion application for Huami Devices (such as Amazfit Bip, Cor, MiBand2/3 and GTS and GTS) and the Pinetime Infinitime"
url="https://github.com/piggz/harbour-amazfish"
# armhf blocked by kdb
arch="all !armhf"
license="GPL-3.0-or-later"
depends="
	kdb-sqlite
	kirigami2
	nemo-qml-plugin-dbus
	qt5-qtconnectivity
	qt5-qtquickcontrols
	"
makedepends="
	kdb-dev
	qt5-qtbase-dev
	qt5-qtconnectivity-dev
	qt5-qtlocation-dev
	qtmpris-dev
	"
source="https://github.com/piggz/harbour-amazfish/archive/$pkgver/harbour-amazfish-$pkgver.tar.gz
	https://github.com/piggz/qble/archive/$_commit_qble/qble-$_commit_qble.tar.gz
	https://github.com/piggz/libwatchfish/archive/$_commit_libwatchfish/libwatchfish-$_commit_libwatchfish.tar.gz
	amazfish-launcher.sh
	amazfish.desktop
	"
options="!check" # No tests
builddir="$srcdir/harbour-amazfish-$pkgver"

prepare() {
	default_prepare

	rmdir qble daemon/libwatchfish
	mv "$srcdir/qble-$_commit_qble" qble
	mv "$srcdir/libwatchfish-$_commit_libwatchfish" daemon/libwatchfish
}

build() {
	qmake-qt5 \
		PREFIX=/usr \
		FLAVOR=kirigami
	make
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	install -Dm644 "$srcdir"/amazfish.desktop -t "$pkgdir"/etc/xdg/autostart/
	install -Dm755 "$srcdir"/amazfish-launcher.sh "$pkgdir"/usr/libexec/amazfish-launcher

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/systemd
}

sha512sums="
a777fca01882760c37633c5d05fd4e0048d32faed38ebdb09b86074eae5641fe3785557268e2da06e737bfc8ac1a191c4575e3338de9e306b8084ea22c0ac58c  harbour-amazfish-2.0.8.tar.gz
551b2c4eefbfa269975da458ebbbfd6fb5346990224adb72cba322c97972b5343515e73aae351c3b18af6c8b9dc2f6da82966f3eca4780effdf978c50845a3dc  qble-3631992ff3bf71a4680f18487e05486c134a1805.tar.gz
78addce4382de53b2d23c920579066b5e080fe51f7b955c42cafafa4dfba34d45a9dc561b622c78a82b602ab276989743ca2ce183f5981c037a5990b7dc92b41  libwatchfish-4ff850cad55866a9e43e2f6ec3488ce792db1196.tar.gz
a17c0d6578e0d6878099f9c913e54100c44dbb94cf8803f2780d5709ec08136daa832ec2ffe947fb8a91e02320f01041d0e763bcc08350270af36d89f767ca14  amazfish-launcher.sh
930f2cae5f88559a83dd46d11d2161a9239efdd46ad6b91dc530eb4a7863f197a7865f9599973b71bcc7d1e2346c848ea7b9a57f5b714560d101b0f384c0f4d1  amazfish.desktop
"
